<?php

/**
 * @author christian
 * @copyright 2011
 */

//echo "registrar ....";
//echo getcwd();
//echo basename(getcwd());
$ruta=$_SERVER['DOCUMENT_ROOT']."/viventura"."/MDGuide";
include_once("$ruta/conf/CConfig.php");
include_once("$ruta/elements/head.tpl");
include_once("$ruta/MDItinerary/MDItineraryEditDraw.php");
include_once("$ruta/MDTourGeneral/CTourEditDraw.php");
include_once("$ruta/MDTourGeneral/CDrawPageReg.php");
include_once("$ruta/view/CDrawMenuTour.php");
include_once("$ruta/star.php");

//$idTourTrack=$_GET['codigo'];


if (!isset($_POST['place_i'])) {$_POST['place_i'] = "NULL"; }
if (!isset($_POST['type'])) {$_POST['type'] = "NULL"; }
if (!isset($_POST['idTour'])) {$_POST['idTour'] = "NULL"; }


$place = $_POST['place_i'];
$idTour = $_POST['idTour'];
$idTourTrack = $_POST['type'];

echo $place;

$items=array("Regresar"=>"CSmallDefinePack.php","Nuevo paquete"=>"g","Ver paquetes"=>"g","Otra"=>"g");

CDrawMenuTour::getInstance()->setMenu($items);
CDrawMenuTour::getInstance()->rigth_side_begin();//empieza lado derecho 
CDrawMenuTour::getInstance()->DrawDivAdBegin("content_area_user_title","1");echo "<h1>Destino Sur</h1>";
CDrawMenuTour::getInstance()->DrawDivAdEnd();


$action="CManageTrack.php";$name="formulario_registro";$method="post";$NAME="Itinerario";
MDItineraryEditDraw::getInstance()->DrawHead($action,$name,$method,$NAME);

CTourEditDraw::getInstance()->HiddenValue($idTourTrack,"idTourTrack");
	

if($place==0){
    
    $item0=array("DateBegTrack"=>"Inicio");
    CDrawPageReg::getInstance()->DrawTextBox($item0);
    
    
    $items1=array("DateEndTrack"=>"Final");
    //$items2
    $idt = "select idTourTrack from tour_has_track where OrdTrack=1 and TOUR_idTour=$idTour";
    $table = CModelo::getInstance()->getData($idt);
    
    foreach($table as $c=>$r ){
        $table1 = $r ;
        foreach($table1 as $c1 => $r1 ){
        $idTourTrack=$r1;    
        }
    }
    echo $idTourTrack;
    MDItineraryEditDraw::getInstance()->DrawTextFillBox("",$items1, "tour_has_track", $idTourTrack);

}
elseif($place==1){
    
      $item0= array("DateBegTrack"=>"Inicio");
      $item1= array("DateEndTrack"=>"Final");
    //
    //$items2
   
   
    $numa = "select count(*) from tour_has_track where tour_idTour=$idTour"; 
    $num = CModelo::getInstance()->getData($numa);

//Conteo de pasajeros del tour
    foreach($num as $r=>$c){
    $table=$c;
    foreach($table as $r2=>$c2){
        $numero = $c2;
    }
    
}
   
    $idt = "select idTourTrack from tour_has_track where OrdTrack=$numero and TOUR_idTour=$idTour";
    $table = CModelo::getInstance()->getData($idt);
    
    foreach($table as $c=>$r ){
        $table1 = $r ;
        foreach($table1 as $c1 => $r1 ){
        $idTourTrack=$r1;
        }}
    
       MDItineraryEditDraw::getInstance()->DrawTextFillBox("",$item0, "tour_has_track", $idTourTrack);
       CDrawPageReg::getInstance()->DrawTextBox($item1);
   
    
        
    }
    

else{}

MDItineraryEditDraw::getInstance()->DrawSubmmit("Actualizar");
MDItineraryEditDraw::getInstance()->DrawFoot();
include_once("$ruta/elements/foot.tpl");


?>

